<template>
  <div>
    <!-- 上传 -->
    <el-upload
      class="upload-demo"
      name="file"
      show-file-list=false
      :action="this.utils.myurl.uploadCouponTemp"
      :on-success="uploadSuccess">
      <el-button size="small" type="primary">导入模板</el-button>
    </el-upload>
    <!-- 表单 -->
    <Table ref="myTable" :tableTitles="titles" :url="this.utils.myurl.couponTempList"/>
  </div>
</template>

<script>
  import Table from './Table.vue'

  export default {
    name: "CouponTempalte",
    components: {Table},
    methods: {
      //上传成功的回调
      uploadSuccess(){
        console.log("上传成功！");
        this.$refs.myTable.goPage();
      }
    },
    data() {
      return {
        titles: [{
            prop: 'cid',
            label: 'id',
            width: '50',
            fixed: true
          },{
            prop: 'templateName',
            label: '模板名称',
            width: '250',
            fixed: false
          },{
            prop: 'type',
            label: '模板规则类型',
            width: '200',
            fixed: false
          },{
            prop: 'dyncTemplate',
            label: '规则内容',
            width: '250',
            fixed: false
          },{
            prop: 'createTime',
            label: '创建时间',
            width: '200',
            fixed: false
          },{
            prop: 'status',
            label: '状态',
            width: '50',
            fixed: false
          }]
      }
    }
  }
</script>

<style>
</style>
